package com.lanqiao.guimei.dao;

import com.lanqiao.guimei.vo.Vendor;
import org.apache.commons.dbutils.handlers.BeanListHandler;
import org.apache.log4j.Logger;

import java.sql.SQLException;
import java.util.List;

/**
 * 供应商表CUDR
 * @author stone(huangshizhang) at 2019-08-17 22:15
 */
public class VendorDao extends BaseDao {

    Logger logger = Logger.getLogger(Vendor.class);

    /**
     * 查询所有的厂家信息
     *
     * @return
     */
    public List<Vendor> findAll(){
        try {
            return runner.query("select VEN_ID venId, VEN_NAME venName, VEN_ADDR venAddr from VENDOR"
                    , new BeanListHandler<>(Vendor.class));
        } catch (SQLException e) {
            logger.error("查询所有的厂家信息错误：" + e);
        }
        return null;
    }
}
